package com.ly.work.CreatThread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class FutureTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //创建线程的方法
        FutureTask<Object> dd = new FutureTask<Object>(new Callable() {
            @Override
            public Object call() throws Exception {
                return "ss";
            }
        });


        FutureTask<Object> f1 = new FutureTask<>((Callable<Object>) () -> {
            return "ll";
        });


        Thread thread = new Thread(() -> {
            System.out.println("ddd");
        });

        new Thread(f1).start();

        //获取线程返回值
        System.out.println(f1.get());

    }
}
